<%-- 
    Document   : clients_list_admin
    Created on : 30/Nov/2009, 15:18:01
    Author     : Daniel
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="java.util.Enumeration" %>
<jsp:useBean class="Cliente.WebGestor" id="webMyTwi" scope="session"/>

<%

System.out.println("----- OPERACAO ------");
Enumeration<String>flag=request.getParameterNames();
while(flag.hasMoreElements()){
    String opera=flag.nextElement();
    System.out.println(opera+":"+request.getParameter(opera));
}

String []offlineUsers = null;
String [] onlineUsers = null;

if("Refresh".contains(request.getParameter("refresh"))){
    if("Offline".equalsIgnoreCase(request.getParameter("mode"))){
       offlineUsers = webMyTwi.getGereAdmin().verificaOnOff("off");
    }
    if("Online".equalsIgnoreCase(request.getParameter("mode"))){
        onlineUsers = webMyTwi.getGereAdmin().verificaOnOff("on");
    }
}

/*else{
    offlineUsers[0]=" ";
    offlineUsers[1]=" ";
    onlineUsers[0]=" ";
    onlineUsers[1]=" ";
}*/

%>

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title></title>
    </head>
    <body>
        <table border="0">
            <tbody>
                <tr>
                    <td>
                        <textarea name="users" rows="5" cols="35" readonly="readonly" style="background:transparent; background-image:url(IMG/bg-txt.png); background-repeat:repeat"><%
                            int i;
                            String op = request.getParameter("refresh");
                            String state = request.getParameter("mode");
                            if ("Refresh".equalsIgnoreCase(op)){
                                if ("Online".equalsIgnoreCase(state)){
                                    for (i = 1; i < onlineUsers.length; i++){
                                        %><%= onlineUsers[i]+"\n"%><%
                                    }
                                }
                                if ("Offline".equalsIgnoreCase(state)){
                                    for (i = 1; i < offlineUsers.length; i++){
                                        %><%= offlineUsers[i]+"\n"%><%
                                    }
                                }
                            }

                        %></textarea>
                    </td>
                </tr>
            </tbody>
        </table>
    </body>
</html>
